<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
     <base href="<%=basePath%>">
    
    <title>My JSP 'add.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link href="css/css.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.9.1.min.js"></script>
	<script src="laydate/laydate.js"></script>
	<script src="js/jquery-1.9.1.min.js"></script>
  </head>
  
  <body>
  <form action="indent/addIndent.do" method="post" name="f1">
  <input type="hidden" name="marketingid" value="${marketing.id}">
  <input name="clientid" type="hidden" value="${client.id}"/>
  <input name="userid" type="hidden" value="${user.id}"/>
  <input name="roomid" type="hidden" value="${room.id}"/>
  
  
  
  
  
 <table width="100%" border="0" cellpadding="0" cellspacing="1" class="ybox04table">
           <t  r>
              <td class="ybox04tdr" colspan="6"><h6 style="color: red;">温馨提示：定金不得低于总房款的5%</h6></td>
              </tr>
 
            <t  r>
              <td class="ybox04tdr" colspan="6">基本信息</td>
              </tr>
            <tr>
              <td  class="ybox04tdl"><span class="red">*</span> 客户姓名：</td>
              <td  class="ybox04tdr"><input name="clientname" type="text" value="${client.clientidname}" readonly="readonly"/></td>
              <td class="ybox04tdl"><span class="red">*</span> 联系方式：</td>
              <td class="ybox04tdr"><input name="clinetelephone" type="text" value="${client.phone}" readonly="readonly"/></td>
              <td class="ybox04tdl">付款方式：</td>
               <td class="ybox04tdr">
               <select name="paymenttype" id="paymenttype">
              <option value="">--------请选择-------</option>
              <option value="一次性付款">-----一次性付款-------</option>
              <option value="分期付款">-------分期付款-------</option>
              <option value="按揭付款">-------按揭付款-------</option>
               </select>
               
               </td>
            </tr>
            
             <tr>
              <td  class="ybox04tdr" colspan="6" >详细信息</td>
             </tr>
            <tr>
            
              <td  class="ybox04tdl"><span class="red">*</span>房间编号:</td>
             <td class="ybox04tdr"><input name="roomnumber" type="text" value="${room.roomnumber}" readonly="readonly"/></td>
              <td  class="ybox04tdl"><span class="red">*</span>业务员姓名:</td>
             <td class="ybox04tdr"><input name="uuu" type="text" value="${user.username}" readonly="readonly"/></td>
              <td  class="ybox04tdl"><span class="red">*</span>订单类型：</td>
             <td class="ybox04tdr"><input name="state" type="text" value="认购" readonly="readonly"/></td>
              
           </tr>   
            <tr>
            
              <td  class="ybox04tdl"><span class="red">*</span>单价/每平米:</td>
             <td class="ybox04tdr"><input name="roomprice" type="text" value="${room.roomprice}" readonly="readonly"/></td>
              <td  class="ybox04tdl"><span class="red">*</span>总价：</td>
             <td class="ybox04tdr"><input name="roomtotal" id="roomtotal" type="text" value="${room.roomtotal}" readonly="readonly"/></td>
              <td  class="ybox04tdl"><span class="red">*</span>购买面积：</td>
             <td class="ybox04tdr"><input name="area" type="text" readonly="readonly" value="${room.area}" readonly="readonly"/></td>
              
           </tr>   
            <tr>
            
              <td  class="ybox04tdl"><span class="red"></span>创建时间：</td>

             <td class="ybox04tdr"><input type="text" name="createTime" value="${date}"/>   
              </td>
             <td class="ybox04tdl"></td><td class="ybox04tdr"></td>
             <td class="ybox04tdl"></td><td class="ybox04tdr"></td>
           </tr>   
           <tr>
            
              <td  class="ybox04tdl"><span class="red"></span>定金：</td>
             <td class="ybox04tdr" colspan="2"><input name="accomplishMoney" id="accomplishMoney" type="text" onblur="tochange()"/>
             <span id="erro" style="color: red;"></span>       
             </td>
              <td class="ybox04tdr"></td>
             <td class="ybox04tdl"></td><td class="ybox04tdr"></td>
           </tr>   
             <tr>
              <td  class="ybox04tdr"  colspan="8"><input type="button" onclick="sb()" value="提交"/>
               <input type="button" value="取消" onclick="end()"/>  </td>
            </tr>
          </table>
</form>
  
  
  
  
  </body>
</html>
<script>

function checkLength(which) {
	var maxChars = 200; //
	if(which.value.length > maxChars){
	   layer.open({
	   icon:2,
	   title:'提示框',
	   content:'您出入的字数超多限制!',	
    });
		// 超过限制的字数了就将 文本框中的内容按规定的字数 截取
		which.value = which.value.substring(0,maxChars);
		return false;
	}else{
		var curr = maxChars - which.value.length; //250 减去 当前输入的
		document.getElementById("sy").innerHTML = curr.toString();
		return true;
	}
};


 function end(){
	window.location.href = "marketing/marketing.do";       
} 

	function sb() {

		var a = $("#accomplishMoney").val();
		var b = $("#roomtotal").val();

		if (a=="" || a==null) {

			alert("定金不能为空");

		} else {
           
  			var c=a/b;
			
			if (c >=0.05 && c <= 1) {
             
				f1.submit();
			} else {

				alert("定金不满足要求");
			}
		}

	}

	/* function a() {
		var userid = document.f1.userid.value;

	} */
</script>

<script>
;!function(){
laydate({
   elem: '#demo'
})
}();


function tochange(){
  				 var accomplishMoney=document.f1.accomplishMoney.value;
  		
 				 var receivableMoney=document.f1.roomtotal.value;
  				
	     $.ajax({
			  url : "indent/toajax.do",
			  type : "post",
			  dataType : "text",
			  data : {accomplishMoney : accomplishMoney,receivableMoney:receivableMoney},
			  success : function(requestXMLTest) {
			
			 document.getElementById("erro").innerHTML=requestXMLTest;
			  },
			   error : function() {
				 alert("error");
			  }
		});

	}


</script>




